/**
 * Family.h
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/07/12
 */

#pragma once

#include "Knot.h"
#include "SKObject.h"
#include "Frame.h"

typedef std::vector<CFrame*> Frames;

class CFamily : public CSKObject
{
public:
	CFamily();
	virtual~ CFamily();

	virtual bool					OnRead(CXMLParser* pParser);
	virtual bool					OnWrite(CXMLParser* pParser);

	Knots*							GetKnots() { return &m_KNOTs; }
	void							Add(CKnot* pKnot) { m_KNOTs.push_back(pKnot); }

	void							Clear();
	void							Remove(CKnot* pKnot);

	CKnot*							GetActiveChild();

	virtual void					SetActive(bool bActive);

	virtual SKObjectType			GetSKObjectType() { return eFamily; }

	virtual void					Render() {}

	virtual void					UpdateExpandStatus(CTreeCtrl* pTree);

	virtual void					Expand(CTreeCtrl* pTree);

	virtual CString					GetName() { return m_strFamilyName; }

	Frames*							GetFrames() { return &m_Frames; }
	void							ClearFrames();
	CFrame*							GetFrameByIndex(long lIndex);

	long							GetMaxTime();
	long							GetMinTime();

private:
	Frames							m_Frames;

// the attributes to be read and writed
private:
	Knots							m_KNOTs;
	CString							m_strFamilyName;
};